<!DOCTYPE html>
<html>
<head>
<script>if (window !== top) top.location.replace(location.href);</script>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="${ctxPath}/assets/expand/images/golo.png" rel="icon">
<title>${constants.getSystemName()!"管理系统"}</title>
<link rel="stylesheet"
	href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}" />
<link rel="stylesheet"
	href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}" />
<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
	<div class="login-wrapper">
		<div class="layui-form">
			<h2>${constants.getSystemName()!"管理系统"}</h2>
			<div style="width:100%;height:4px;background:rgba(71,178,174,1);margin-bottom:30px"></div>
			<div class="login-content">
				<div style="width: 56%;">
					@if(constants.getTenantOpen()){
					<div class="layui-form-item layui-input-icon-group">
						<i class="layui-icon layui-icon-username"></i> <select
							name="tenantCode" id="tenantCode">
							<option value="">默认租户</option>
						</select>
					</div>
					@}
					<div class="layui-form-item layui-input-icon-group">
							<span style="width: 80px;line-height: 40px;text-align: right;margin-right: 10px;">登录账号</span> <input
							class="layui-input" id="username" name="username"
							placeholder="请输入登录账号" value="admin" autocomplete="off"
							lay-verType="tips" lay-verify="required" required />
					</div>
					<div class="layui-form-item layui-input-icon-group">
							<span style="width: 80px;line-height: 40px;text-align: right;margin-right: 10px;">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</span> <input
							class="layui-input" id="password" name="password"
							placeholder="请输入登录密码" value="111111" type="password"
							lay-verType="tips" lay-verify="required" required />
					</div>
					@if(constants.getKaptchaOpen()){
					<div
						class="layui-form-item layui-input-icon-group login-captcha-group">
						<i class="layui-icon layui-icon-auz"></i> <input
							class="layui-input" id="kaptcha" placeholder="请输入验证码"
							autocomplete="off" lay-verType="tips" lay-verify="required"
							required /> <img class="login-captcha" src="${ctxPath}/kaptcha"
							alt="" />
					</div>
					@}
					<!--        <div class="layui-form-item">-->
					<!--            <input type="checkbox" name="remember" title="记住密码" lay-skin="primary" checked>-->
					<!--            <a href="javascript:;" class="layui-link pull-right">注册账号</a>-->
					<!--        </div>-->
					<div class="layui-form-item">
						<button class="layui-btn layui-btn-fluid" id="submit"
							style="background: #DEDEDE;">登录</button>
					</div>
					
				</div>

				<div>
					<img style="width:249px;height:146px" alt="" src="${ctxPath}/assets/common/images/loginImg.png">
				</div>
			</div>
			<div style="float: right;">
				<a href="${ctxPath}/assets/expand/pdf/demo/ceshi.pdf" download="管理后台操作手册下载" style="color: #47B2AE;">管理后台操作手册下载<span><img style="width:22px;height:20px;padding: 10px;" alt="" src="${ctxPath}/assets/common/images/xiazai.png"></span></a>
			</div>
			<!--  <div class="layui-form-item login-oauth-group text-center">
            <a href="${ctxPath}/oauth/render/qq"><i class="layui-icon layui-icon-login-qq" style="color:#3492ed;"></i></a>&emsp;
            <a href="${ctxPath}/oauth/render/gitee">
                <img class="layui-icon" style="height: 28px;width: 28px; margin-top: -12px !important;" src="${ctxPath}/assets/expand/images/git.png" />
            </a>
        </div> -->
		</div>
	</div>
	<!-- <div class="login-copyright">copyright © 2020 stylefeng.cn all rights reserved.</div> -->
	<style>
body {
	background-image: url("${ctxPath}/assets/common/images/adminLogin.png");
	background-repeat: no-repeat;
	background-size: cover;
	min-height: 100vh;
}

body:before {
	content: "";
	background-color: rgba(0, 0, 0, .2);
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

.login-wrapper {
	max-width: 860px;
	padding: 60px;
	margin: 0 auto;
	box-sizing: border-box;
	z-index: 2;
	position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.login-content {
	display: flex;
	align-items: center;
	justify-content: center
}

.login-wrapper>.layui-form {
	padding: 50px 30px;
	width: 660px;
	background: rgba(241,241,241,1);
    border-radius: 22px;
}

.login-wrapper>.layui-form>h2 {
	color: #333;
	font-size: 18px;
	text-align: center;
	margin-bottom: 25px;
}

.login-wrapper>.layui-form>.layui-form-item {
	margin-bottom: 25px;
	position: relative;
	width: 50%;
}

.login-wrapper>.layui-form>.layui-form-item:last-child {
	margin-bottom: 0;
}

.login-wrapper>.layui-form>.layui-form-item>.layui-input {
	height: 46px;
	line-height: 46px;
	border-radius: 2px !important;
}

.login-wrapper .layui-input-icon-group>.layui-input {
	padding-left: 6px;
}

.login-wrapper .layui-input-icon-group>.layui-icon {
	width: 46px;
	height: 46px;
	line-height: 46px;
	font-size: 20px;
	color: #909399;
	text-align: center;
}

.login-wrapper>.layui-form>.layui-form-item.login-captcha-group {
	padding-right: 135px;
}

.login-wrapper>.layui-form>.layui-form-item.login-captcha-group>.login-captcha
	{
	height: 46px;
	width: 120px;
	cursor: pointer;
	box-sizing: border-box;
	border: 1px solid #e6e6e6;
	border-radius: 2px !important;
	position: absolute;
	right: 0;
	top: 0;
}

.login-wrapper>.layui-form>.layui-form-item>.layui-form-checkbox {
	margin: 0 !important;
	padding-left: 25px;
}

.login-wrapper>.layui-form>.layui-form-item>.layui-form-checkbox>.layui-icon
	{
	width: 15px !important;
	height: 15px !important;
}

.login-wrapper>.layui-form .layui-btn-fluid {
	height: 48px;
	line-height: 48px;
	font-size: 16px;
	border-radius: 2px !important;
}

.login-wrapper>.layui-form>.layui-form-item.login-oauth-group>a>.layui-icon
	{
	font-size: 26px;
}

.login-copyright {
	color: #eee;
	padding-bottom: 20px;
	text-align: center;
	position: relative;
	z-index: 1;
}



.login-copyright {
	position: absolute;
	bottom: 0;
	right: 0;
	left: 0;
}

}
.layui-btn {
	background-color: #5FB878;
	border-color: #5FB878;
}

.layui-link {
	color: #5FB878 !important;
}

.layui-form-item{
	display:flex;
}
</style>

	@/* 加入contextPath属性和session超时的配置 */
	<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>

	<!-- js部分 -->
	<script type="text/javascript"
		src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
	<script type="text/javascript"
		src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>
	<script>
    layui.use(['layer', 'form', 'index', 'ax','admin', 'notice'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var $ax = layui.ax;
        var index = layui.index;
        var notice = layui.notice;
        var admin = layui.admin;

        /* 图形验证码 */
        $('img.login-captcha').click(function () {
            this.src = this.src + '?t=' + (new Date).getTime();
        });

        var errorMsg = "${tips!}";
        if (errorMsg) {
            layer.msg(errorMsg, {icon: 5, anim: 6});
        }

        @if(constants.getTenantOpen()){
            //初始化租户列表
            var ajax = new $ax(Feng.ctxPath + "/tenantInfo/listTenants", function (data) {
                for (var i = 0; i < data.data.length; i++) {
                    var name = data.data[i].name;
                    var code = data.data[i].code;
                    $("#tenantCode").append('<option value="' + code + '">' + name + '</option>');
                }
                form.render();
            }, function (data) {
            });
            ajax.start();
        @}

        //登录操作
        $('#submit').click(function () {
            var ajax = new $ax(Feng.ctxPath + "/login", function (data) {
                Feng.success("登录成功!");
                
                // var ajax = new $ax(Feng.ctxPath + "/system/ext_one_login");
                // var result = ajax.start();
                // if(result.data==null || result.data =='1'){
                //         var langs = layui.data('system').lang;
                //         admin.open({
                //             id: 'pswForm',
                //             type: 2,
                //             title: "首次登录需要修改密码",
                //             shade: 0,
                //             content: '${ctxPath}/system/user_one_login_chpwd'
                //         });
                // }else{
                    index.clearTabCache();
                    window.location.href = Feng.ctxPath + "/";
                // }
            }, function (data) {
                layer.msg("登录失败！" + data.responseJSON.message, {icon: 5, anim: 6});
            });
            ajax.set("username", $("#username").val());
            ajax.set("password", $("#password").val());
            @if(constants.getTenantOpen()){
                ajax.set("tenantCode", $("#tenantCode").val());
            @}
            @if(constants.getKaptchaOpen()){
                ajax.set("kaptcha", $("#kaptcha").val());
            @}
            ajax.start();
        });
		
        if($("#username").val() != null && $("#username").val() != ''
        		&& $("#password").val() != null && $("#password").val() != ''){
        	$("#submit").css("backgroundColor","#5DD9DB");
        }
        $("#username").blur(function(){
        	if($("#username").val() != null && $("#username").val() != ''
        		&& $("#password").val() != null && $("#password").val() != ''){
        		$("#submit").css("backgroundColor","#5DD9DB");
        	}else{
        		$("#submit").css("backgroundColor","#DEDEDE");
        	}
        });
        
        $("#password").blur(function(){
        	if($("#username").val() != null && $("#username").val() != ''
        		&& $("#password").val() != null && $("#password").val() != ''){
        		$("#submit").css("backgroundColor","#5DD9DB");
        	}else{
        		$("#submit").css("backgroundColor","#DEDEDE");
        	}
        });
        
        
    });
</script>


</body>
</html>